<?php
/** 用户咨询，报错，问答
 */
class DialogueModel extends Model {
	
	public function addDialogue($ownerid,$ownertype,$sort_id,$question_text){
		
		//设置默认值
		$data['ownerid']		=$ownerid;			
		$data['ownertype']		=$ownertype;				
		$data['sort_id']		=$sort_id;			
		$data['question_text']	=$question_text;		
		$data['ctime']		=time();
		
		$id = $this->add($data);
		
		return $id;
	}
	
	public function updateDialogue($id,$answer_text,$adminid){
					
		$data['admin_id']		=$adminid;			
		$data['answer_text']	=$answer_text;		
		$data['mtime']		=time();
		
		$no = $this->where("id=".$id)->save($data);
		
		return $no;
	}
	
	
	public function searchDialogue($map,$order=' ctime ',$limit=20){
		$pagedata = $this->kPageQuery($map,$order,$limit);
		return $pagedata;
	}
}
?>